<?php

/**
 * WeEngine System
 *
 * (c) We7Team 2021 <https://www.w7.cc>
 *
 * This is not a free software
 * Using it under the license terms
 * visited https://www.w7.cc for more details
 */

namespace W7\Addons\demo_engine_wechat\Upgrade300;

use W7\Sdk\OpenCloud\Contracts\ModuleUpgradeInterface;

class Up implements ModuleUpgradeInterface
{
    public function database(): array
    {
        $sql[] = <<<EOF
CREATE TABLE IF NOT EXISTS `ims_account300` (
  `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
  `user_group_id` int(10) NOT NULL DEFAULT '0' COMMENT 'user_group表所属ID',
  `username` varchar(30) NOT NULL COMMENT '用户名',
  `password` varchar(200) NOT NULL COMMENT '用户密码',
  PRIMARY KEY(`id`)
) COMMENT='用户表';
EOF;
        $sql[] = "INSERT INTO `ims_account300` (`user_group_id`, `username`, `password`) VALUES (10, 'admin', '591a8ceb9b5b606c3c2e535b82b262b5df30fe65');";
        return $sql;
    }
    
    public function script(): bool
    {
        file_put_contents('./aaa.txt', 300, FILE_APPEND);
        return true;
    }
}
